package d01_Arrays;

public class Student implements Comparable<Student>{
    private String name;
    private double heigth;
    private int age;

    public Student() {
    }

    public Student(String name, double heigth, int age) {
        this.name = name;
        this.heigth = heigth;
        this.age = age;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public double getHeigth() {
        return heigth;
    }

    public void setHeigth(double heigth) {
        this.heigth = heigth;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", heigth=" + heigth +
                ", age=" + age +
                '}'+"\n";
    }

    @Override
    public int compareTo(Student o) {
        if(this.age >o.age){
            return 1;
        }else if (this.age<o.age){
            return -1;
        }
        return 0;
    }
}
